package cn.task.service.impl;

import cn.task.entity.Appointment;
import cn.task.mapper.AppointmentMapper;
import cn.task.service.AppointmentService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 @author Mengru Jiao
 @date 2025/5/29
 @project java-ai-langchain4j
 */
@Service
public class AppointmentServiceImpl extends ServiceImpl<AppointmentMapper, Appointment>  implements AppointmentService {
    /**
     * 查询订单是否存在
     * @param appointment
     * @return
     */
    @Override
    public Appointment getOne(Appointment appointment) {
        LambdaQueryWrapper<Appointment> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(Appointment::getUsername, appointment.getUsername());
        wrapper.eq(Appointment::getIdCard, appointment.getIdCard());
        wrapper.eq(Appointment::getDepartment, appointment.getDepartment());
        wrapper.eq(Appointment::getDate, appointment.getDate());
        wrapper.eq(Appointment::getTime, appointment.getTime());
        //从父类继承的baseMapper 不用再注入了
        Appointment appointmentDB = baseMapper.selectOne(wrapper);
        return appointmentDB;
    }
}
